package _3ChapterThree._13ReplaceTypeCodeWithClass.step2;

public class BloodGroup {
    public static BloodGroup O = new BloodGroup(0);
    public static BloodGroup A = new BloodGroup(1);
    public static BloodGroup B = new BloodGroup(2);
    public static BloodGroup AB = new BloodGroup(3);

    private static final BloodGroup[] values = {O,A,B,AB};

    private final int code;

    private BloodGroup(int code){
        this.code = code;
    }

    public int getCode(){
        return code;
    }

    public static BloodGroup code(int arg){
        return values[arg];
    }
}
